package exception;

import java.io.FileNotFoundException;

public class ThrowDemo {
    public static void main(String[] args) {
        Student zs = new Student();
        try {
            zs.setAge(5602);
        } catch (Exception e) {
            System.out.println("发生异常,解决了");
        }
        System.out.println("此人的年龄为"+zs.getAge()+"岁");

        /*Student zs = new Student();
        try {
            zs.setAge(5602);
            System.out.println("此人的年龄为"+zs.getAge()+"岁");
        }catch (RuntimeException e){
            System.out.println("年龄不合法");
        }
         */
    }
}
